home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / misc / math / Laplace.lha / Laplace / Data / Tools.lha / PrintManual < prev    next >
Encoding:
Text File  |  1996-09-18  |  14.9 KB  |  377 lines

  1. ;------------------------------------------------------------------------
  2. ;
  3. ; Laplace Manual Printing script
  4. ;
  5. ; $VER: Laplace-PrintManual 1.0 (19.9.96)
  6. ;
  7. ; Script: (C)1996 by A Vision of Paradise
  8. ; Installer: (C)1996 ESCOM AG
  9. ; written by P!\K
  10. ;
  11. ;------------------------------------------------------------------------
  12.  
  13. ;-1- "language definitions"
  14. (if (= @language "deutsch")
  15.     (
  16. ;-1- "deutsch"
  17.         (set @abort-button "Skript abbrechen")
  18.         (set #script-description "Dieses Skript druckt die DVI Version der Anleitung zu Laplace auf DIN A4 Papier. Dazu wird eine komplette Installation von PasTeX1.4 benötigt. PasTeX ist im Aminet zu finden.")
  19.         (set #no-laplace-installation "Laplace wurde nicht richtig installiert.\nIch kann mit dem Skript nicht fortfahren.")
  20.         (set #no-pastex-found "Dieses Skript benötigt PasTeX V1.4. Es ist im Aminet zufinden, Verzeichnis 'text/tex/', Datei 'pt14l.lha'. Achtung, dabei handelt es sich um eine 10MB Datei! Es ist auch auf diversen CD-ROMs zu finden.")
  21.         (set #ask-languages-prompt "Wähle bitte die Sprachen, die gedruckt werden sollen..")
  22.         (set #ask-languages-help (cat
  23.             "Du kannst natürlich alle Sprachen ausdrucken, ich denke aber, daß Du nur an einer Version interessiert bist.\n"
  24.             "Beachte bitte, daß Du für jede Sprache die entsprechende DVI Anleitung installiert haben mußt.\n"
  25.             "\n"
  26.             @askoptions-help
  27.           )
  28.         )
  29.         (set #no-languages-selected "Es wurden keine Sprachen ausgewählt. Das Skript wird abgebrochen.")
  30.         (set #ask-pagemode-prompt "Wi sollen die Seiten bedruckt werden?")
  31.         (set #ask-pagemode-help (cat
  32.             "Einzelseiten:\n"
  33.             "  eine Seite auf ein Blatt Papier.\n"
  34.             "Doppelseiten:\n"
  35.             "  verkleinert die Seitengröße und druckt zwei Seiten auf ein Blatt Papier.\n"
  36.             "\n"
  37.             @askchoice-help
  38.           )
  39.         )
  40.         (set #ask-pagemode-single "Einzelseiten")
  41.         (set #ask-pagemode-double "Doppelseiten")
  42.         (set #ask-sortmode-prompt "In welcher Reihenfolge sollen die Seiten gedruckt werden?")
  43.         (set #ask-sortmode-help (cat
  44.             "fortlaufend:\n"
  45.             "  alle Seiten nacheinander.\n"
  46.             "zuerst ungerade, dann gerade Seiten:\n"
  47.             "  druckt zuerst die Seiten 1, 3, 5..., dann 2, 4, 6... Indem das Papier nach dem ersten Durchgang wieder in den Drucker eingelegt wird, können beide Seiten bedruckt werden.\n"
  48.             "\n"
  49.             @askchoice-help
  50.           )
  51.         )
  52.         (set #ask-sortmode-cont "fortlaufend")
  53.         (set #ask-sortmode-skip "zuerst ungerade, dann gerade Seiten")
  54.         (set #ask-measure-prompt "Willst Du zuerst eine Testseiten drucken?")
  55.         (set #ask-measure-help (cat
  56.             "Um den vertikalen und horizontalen Offset an den Drucker anzupassen, kannst Du zuerst ein paar Testseiten drucken.\n"
  57.             "Die Standardwerte sind an meinen Epson Stylus Color IIs angepaßt, ich weiß nicht, wie sie mit anderen Druckern funktionieren.\n"
  58.           )
  59.         )
  60.         (set #ask-voffset-prompt "Gebe bitte den vertikalen Offset an.")
  61.         (set #ask-hoffset-prompt "Gebe bitte den horizontalen Offset an.")
  62.         (set #ask-offset-help (cat
  63.             "Offset um die Seite auf dem Blatt zu positionieren.\n"
  64.             "Gebe bitte einen Wert, gefolgt von einer Einheit an. Erlaubt Einheiten sind:\n"
  65.             "   pt - Punkt\n"
  66.             "   cm - Zentimeter\n"
  67.             "   mm - Millimeter\n"
  68.             "   in - Inch, 1in = 72.27pt\n"
  69.             "   pc - Pica, 1pc = 12pt\n"
  70.             "   dd - Didôt Punkt, 1157dd = 1238 pt\n"
  71.             "   cc - Cicero, 1cc = 12dd\n"
  72.             "   bp - Big point 72bp = 1in\n"
  73.             "\n"
  74.             @askstring-help
  75.           )
  76.         )
  77.         (set #ask-printername-prompt "Gebe bitte den Namen Deines Druckers an.")
  78.         (set #ask-printername-help (cat
  79.             "Gebe den Namen, so wie er von DVIPrint verlangt wird, an.\n"
  80.             "Falls Du ihn nicht kennst, öffne eine Shell und geben 'alias' ein. Eine der Zeilen sollte wie folgt aussehen:\n"
  81.             "dp     run dviprint P=DEINDRUCKER ...\n"
  82.             "'DEINDRUCKER' ist genau das, was Du angeben mußt.\n"
  83.             "\n"
  84.             @askstring-help
  85.           )
  86.         )
  87.         (set #print-doc "Drucke \"%s\"...")
  88.         (set #no-dvifile "Kann \"%s\" nicht öffnen...\nHast Du es vielleicht nicht installiert!?!")
  89.         (set #printdoc-even "Jetzt werde ich die geraden Seiten drucken, lege dazu den das Papier wieder in den Eingabeschacht.")
  90.         (set #dviprint-prompt "Ich werde nun DVIPrint für die Datei \"%s\" aufrufen.")
  91.         (set #dviprint-help "Und los...")
  92.         (set #dviprint-error-prompt "DVIPrint has einen Fehlerkode zurück geliefert.\nEs scheint ein Problem gegeben zu haben.")
  93.         (set #dviprint-error-help (cat
  94.             "DVIPrint war nicht in der Lage, die Anleitung zu drucken. Dafür kann es verscheidene Ursachen geben:\n"
  95.             "  Der angegeben Druckername war falsch.\n"
  96.             "  Du hast nicht genug freien Speicher (DVIPrint benötigt viel ChipMem)\n"
  97.             "  Deine TeX Installation ist defekt.\n"
  98.             "\n"
  99.             "Um genaueres zu erfahren, kannst Du die Datei \"T:DVIPrint.out\" ansehen."
  100.             "\n"
  101.             @askbool-help
  102.           )
  103.         )
  104.         (set #dviprint-error-proceed "Proceed")
  105.         (set #dviprint-error-abort "Abort")
  106. ;-2-
  107.     )
  108.     (if (= @language "pladd")
  109.         (
  110.             (abort "not implemented")
  111.         )
  112.         (
  113. ;-1- "english"
  114.             (set @abort-button "Abort script")
  115.             (set #script-description "This script prints the DVI version of the manual for Laplace on DIN A4 paper. You need a complete installation of PasTeX1.4 to proceed. PasTeX can be found in the Aminet.")
  116.             (set #no-laplace-installation "Laplace is not properly installed.\nI cannot proceed with this script.")
  117.             (set #no-pastex-found "This script requires PasTeX V1.4. It can be found in the Aminet, directory 'text/tex/', file 'pt14l.lha'. Attention, this is a 10MB file! It can also be found on some CD-ROMs.")
  118.             (set #ask-languages-prompt "Select the languages that should be installed.")
  119.             (set #ask-languages-help (cat
  120.                 "If you like, you can print all manuals at once, but I think you are only interested in one language.\n"
  121.                 "Note that you must have installed the DVI manual for each selected language.\n"
  122.                 "\n"
  123.                 @askoptions-help
  124.               )
  125.             )
  126.             (set #no-languages-selected "No languages are selected. Aborting script.")
  127.             (set #ask-pagemode-prompt "How should the pages be arranged?")
  128.             (set #ask-pagemode-help (cat
  129.                 "single pages:\n"
  130.                 "  just print one page on one piece of paper.\n"
  131.                 "double pages:\n"
  132.                 "  reduce pages size and print two pages on one piece of paper.\n"
  133.                 "\n"
  134.                 @choice-help
  135.               )
  136.             )
  137.             (set #ask-pagemode-single "single pages")
  138.             (set #ask-pagemode-double "double pages")
  139.             (set #ask-sortmode-prompt "In which order should the pages be printed?")
  140.             (set #ask-sortmode-help (cat
  141.                 "continous:\n"
  142.                 "  print all pages one after the other.\n"
  143.                 "first odd, then even pages:\n"
  144.                 "  prints first pages 1, 3, 5..., then 2, 4, 6... Reinsert the paper after the first pass to use both sides.\n"
  145.                 "\n"
  146.                 @askchoice-help
  147.               )
  148.             )
  149.             (set #ask-sortmode-cont "continuous")
  150.             (set #ask-sortmode-skip "first odd, then even pages")
  151.             (set #ask-measure-prompt "You you want to print a test page?")
  152.             (set #ask-measure-help (cat
  153.                 "To adjust the vertical and horizonal offsets to your printer, you can first print some test pages.\n"
  154.                 "The default values work fine with my Epson Stylus Color IIs, but I don't know how they look with other printers.\n"
  155.               )
  156.             )
  157.             (set #ask-voffset-prompt "Please enter vertical offset.")
  158.             (set #ask-hoffset-prompt "Please enter horizontal offset.")
  159.             (set #ask-offset-help (cat
  160.                 "Offset to place the page on the piece of paper.\n"
  161.                 "Please enter a value follow by unit. Valid units are:\n"
  162.                 "   pt - points\n"
  163.                 "   cm - centimeter\n"
  164.                 "   mm - millimeter\n"
  165.                 "   in - inch, 1in = 72.27pt\n"
  166.                 "   pc - pica, 1pc = 12pt\n"
  167.                 "   dd - didôt point, 1157dd = 1238 pt\n"
  168.                 "   cc - cicero, 1cc = 12dd\n"
  169.                 "   bp - big point 72bp = 1in\n"
  170.                 "\n"
  171.                 @askstring-help
  172.               )
  173.             )
  174.             (set #ask-printername-prompt "Please enter the name of your printer.")
  175.             (set #ask-printername-help (cat
  176.                 "Enter the name that is to be used for DVIPrint.\n"
  177.                 "If you don't know it, open a shell and enter 'alias'. "
  178.                 "There should be a line like:\n"
  179.                 "dp     run dviprint P=YOURPRINTER ...\n"
  180.                 "'YOURPRINTER' is exactly what you have to enter.\n"
  181.                 "\n"
  182.                 @askstring-help
  183.               )
  184.             )
  185.             (set #print-doc "Printing \"%s\"...")
  186.             (set #no-dvifile "Unable to open \"%s\"...\nPerhaps you didn't install it!?!")
  187.             (set #printdoc-even "Now I will print the even pages, please reinsert the paper to your printer.")
  188.             (set #dviprint-prompt "I will now run DVIPrint on the file \"%s\".")
  189.             (set #dviprint-help "And go...")
  190.             (set #dviprint-error-prompt "DVIPrint returned an error code.\nThere seems to be a problem.")
  191.             (set #dviprint-error-help (cat
  192.                 "DVIPrint was not able to print the manual. There could be several reasons:\n"
  193.                 "  The selected printername is wrong.\n"
  194.                 "  You don't have enough free memory (DVIPrint need much chipmem)\n"
  195.                 "  Your TeX installations is corrupted.\n"
  196.                 "\n"
  197.                 "To have a closer look at the error reason, look at the file \"T:DVIPrint.out\"."
  198.                 "\n"
  199.                 @askbool-help
  200.               )
  201.             )
  202.             (set #dviprint-error-proceed "Proceed")
  203.             (set #dviprint-error-abort "Abort")
  204. ;-2-
  205.         )
  206.     )
  207. )
  208. ;-2-
  209.  
  210. (procedure P_DVIPRINT #dviprint-path #dviprint-opts
  211. ;    (message ("TeX:bin/DVIPrint >CON: PRINTER=%s HOFF=%s VOFF=%s %s PHYSICAL NOLOG \"%s\"" #printername #hoffset #voffset #dviprint-opts #dviprint-path))
  212.     (if (run
  213.             (prompt (#dviprint-prompt #dviprint-path))
  214.             (help #dviprint-help)
  215.             ("TeX:bin/DVIPrint >T:DVIPrint.out PRINTER=%s HOFF=%s VOFF=%s %s PHYSICAL NOLOG \"%s\"" #printername #hoffset #voffset #dviprint-opts #dviprint-path)
  216.             (confirm)
  217.         )
  218.         (if (not (askbool
  219.                     (prompt #dviprint-error-prompt)
  220.                     (help #dviprint-error-help)
  221.                     (choices #dviprint-error-proceed #dviprint-error-abort)
  222.                     (default 1)
  223.                  )
  224.             )
  225.             (exit (quiet))
  226.         )
  227.     )
  228. )
  229.  
  230. (procedure P_DVIDVI #dvidvi-path
  231.     (run ("TeX:bin/dvidvi -m 2:0(-0.58,-0.75),1(7.98,-0.75) -sm -2 -sw 4 \"%s\" t:Manual.dvi" #dvidvi-path))
  232. )
  233.  
  234. (procedure P_PRINTDOC #printdoc-path
  235.     (
  236.         (working (#print-doc #printdoc-path))
  237.         (if (exists #printdoc-path)
  238.             (select #pagemode
  239.                  (select #sortmode
  240.                      (P_DVIPRINT #printdoc-path "")
  241.                      (
  242.                         (P_DVIPRINT #printdoc-path "ODD")
  243.                         (message #printdoc-even)
  244.                         (P_DVIPRINT #printdoc-path "EVEN")
  245.                      )
  246.                  )
  247.                  (
  248.                     (P_DVIDVI #printdoc-path)
  249.                     (select #sortmode
  250.                         (P_DVIPRINT "T:Manual.dvi" "LANDSCAPE")
  251.                         (
  252.                            (P_DVIPRINT "T:Manual.dvi" "LANDSCAPE ODD")
  253.                            (message #printdoc-even)
  254.                            (P_DVIPRINT "T:Manual.dvi" "LANDSCAPE EVEN")
  255.                         )
  256.                     )
  257.                     (delete "T:Manual.dvi")
  258.                  )
  259.             )
  260.             (message (#no-dvifile #printdoc-path))
  261.         )
  262.     )
  263. )
  264.  
  265. (procedure P_FAKEINSTALLER
  266.     (welcome)
  267. )
  268.  
  269. ;-1- "main menu"
  270. (complete 0)
  271.  
  272. (message #script-description)
  273.  
  274. (if (not (exists "ENVARC:Laplace"))
  275.     (abort #no-laplace-installation)
  276. )
  277.  
  278. (run "GetConfig >ENV:Laplace_Version VERSION")
  279. (run "GetConfig >ENV:Laplace_Path PATH")
  280.  
  281. (set #laplace-path (getenv "Laplace_Path"))
  282. (set #laplace-version (getenv "Laplace_Version"))
  283.  
  284. (if (not (exists "TeX:" (noreq)))
  285.     (abort #no-tex-found)
  286. )
  287.  
  288. (set #languages (askoptions
  289.         (prompt #ask-languages-prompt)
  290.         (help #ask-languages-help)
  291.         (choices "english" "deutsch")
  292.         (default (if (= @language "deutsch")
  293.                      2
  294.                      1
  295.                  )
  296.         )
  297.     )
  298. )
  299.  
  300. (if (= #languages 0)
  301.     (abort #no-languages-selected)
  302. )
  303.  
  304. (set #pagemode (askchoice
  305.         (prompt #ask-pagemode-prompt)
  306.         (help #ask-pagemode-help)
  307.         (choices #ask-pagemode-single #ask-pagemode-double)
  308.         (default 0)
  309.     )
  310. )
  311.  
  312. (set #sortmode (askchoice
  313.         (prompt #ask-sortmode-prompt)
  314.         (help #ask-sortmode-help)
  315.         (choices #ask-sortmode-cont #ask-sortmode-skip)
  316.         (default 0)
  317.     )
  318. )
  319.  
  320. (set #printername (askstring
  321.         (prompt #ask-printername-prompt)
  322.         (help #ask-printername-help)
  323.         (default "STYLUS")
  324.     )
  325. )
  326. (set #voffset (askstring
  327.        (prompt #ask-voffset-prompt)
  328.        (help #ask-offset-help)
  329.        (default "21.6mm")
  330.    )
  331. )
  332. (set #hoffset (askstring
  333.         (prompt #ask-hoffset-prompt)
  334.         (help #ask-offset-help)
  335.         (default "30.6mm")
  336.     )
  337. )
  338.  
  339. (while (= 1 (askbool
  340.                 (prompt #ask-measure-prompt)
  341.                 (help #ask-measure-help)
  342.                 (default 0)
  343.            )
  344.        )
  345.        (
  346.            (select #pagemode
  347.                 (P_DVIPRINT (tackon #laplace-path "Laplace/Docs/Template_single.dvi") "")
  348.                 (P_DVIPRINT (tackon #laplace-path "Laplace/Docs/Template_double.dvi") "LANDSCAPE")
  349.            )
  350.            (set #voffset (askstring
  351.                   (prompt #ask-voffset-prompt)
  352.                   (help #ask-offset-help)
  353.                   (default #voffset)
  354.               )
  355.            )
  356.            (set #hoffset (askstring
  357.                    (prompt #ask-hoffset-prompt)
  358.                    (help #ask-offset-help)
  359.                    (default #hoffset)
  360.                )
  361.            )
  362.        )
  363. )
  364.  
  365. (if (in #languages 0)
  366.     (P_PRINTDOC (tackon #laplace-path "Laplace/Docs/english/Manual.dvi"))
  367. )
  368.  
  369. (if (in #languages 1)
  370.     (P_PRINTDOC (tackon #laplace-path "Laplace/Docs/deutsch/Anleitung.dvi"))
  371. )
  372.  
  373. (complete 100)
  374. (exit (quiet))
  375. ;-2-
  376.  
  377.